<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>判断两个对象的键值对是否相同</title>
</head>

<body>
    <script>
        var obj1 = {
            name: 'Jie ke',
            age: 18
        };
        var obj2 = {
            name: 'Jie ke',
            age: 29
        };
        // 属性就是键名，属性值就是键值
        for(var arr1 in obj1) {};// 遍历obj1对象的键名
        for(var arr2 in obj2) {};// 遍历obj2对象的键名
        if(obj1[arr1] == obj2[arr2]) {// 判断obj1对象的键值是否等于obj2对象的键值
            console.log('这两个对象的键值相同');
        }else{
            console.log('这两个对象的键值不相同')
        }
    </script>
</body>

</html>